package com.aotao.springboot.controller;

import com.aotao.springboot.domain.Article;
import com.aotao.springboot.mapper.ArticleMapper;
import com.aotao.springboot.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class IndexController {
    @Autowired
    private ArticleService articleService;

    @RequestMapping("/toIndex")
    public String toIndex(Model model){
        List<Article> articles = articleService.getArticle();
        model.addAttribute("articles",articles);
        return "index";
    }
}
